#!/usr/bin/env python3
#-*- coding:utf8 -*-
# Power by 2020-06-11 22:44:14

import paddle
import paddle.fluid as fluid
from paddle.fluid.dygraph.nn import Conv2D,Pool2D,Linear

class MNIST(fluid.dygraph.Layer):

    """Docstring for MNIST. """

    def __init__(self):
        """TODO: to be defined. """
        super(MNIST,self).__init__()
        self.conv1=Conv2D(num_channels=1,num_filters=20,filter_size=5,stride=1,padding=2,act='relu')
        self.pool1=Pool2D(pool_size=2,pool_stride=2,pool_type='max')
        self.conv2=Conv2D(num_channels=20,num_filters=20,filter_size=5,stride=1,padding=2,act='relu')
        self.pool2=Pool2D(pool_size=2,pool_stride=2,pool_type='max')
        self.fc=Linear(input_dim=980,output_dim=1,act=None)
    def forward(self, inputs,label=None):
        """TODO: Docstring for forward.

        :inputs: TODO
        :label: TODO
        :returns: TODO

        """
        x=self.conv1(inputs)
        x=self.pool1(x)
        x=self.conv2(x)
        x=self.pool2(x)
        x=fluid.layers.reshape(x,[x.shape[0],-1])
        x=self.fc(x)
        return x

        
